#ifndef __SETTINGS_H__
#define __SETTINGS_H__

#define GPU_NO_THRESHOLD

#include <iostream>
#include<fstream>
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <string.h>
#include <math.h>
#include <cutil_inline.h>

using namespace std;

enum MATCH_CASE {
	MIS1_BACKWARD, MIS1_FORWARD,
	MIS2_CASE_A, MIS2_CASE_B, MIS2_CASE_C, MIS2_CASE_D
};


#define TEXTURE_WIDTH           (65536)


#define ALPHABET_SIZE 4
static char ALPHABET[ALPHABET_SIZE] = {'A','C','G','T'};
static const int MAX_FILE_NAME_LENGTH= 100 ;  
static const unsigned int REFERENCE_LENGTH = 3000000000;
#define MAX_QUERY_LENGTH	(200)			//used by the shift table, by Mian
#define  QUERY_LENGTH 		(100)
//static const int QUERY_NUM = 1000000;
static const int TABLE_SIZE = 13;
static const int MAX_MISMATCH_NUM = 2;
static const int maxBufferNum = 50000000;
#define sizeX 	floor((double)QUERY_LENGTH * 0.3f)
#define sizeY  	(sizeX * 2)
#define sizeZ   (QUERY_LENGTH)

static int MM_RANGE = 0;
static int MM_RANGE2 = 0;

#define CHAR_PER_WORD		(16)
#define LOG2_CHAR_PER_WORD	(4) 	
#define CHAR_PER_LONG		(32)
#define FORWARD		0
#define BACKWARD	1
#define OCC_VALUE_PER_WORD                      2
#define OCC_MINOR_INTERVAL                            256
#define WORD_BETWEEN_OCC                        16
#define OCC_MAJOR_INTERVAL                      65536
#define COUNT_MAP_SIZE				65536
#define DEVICE_COUNT_MAP_SIZE			256
#define CHAR_PER_HALF_WORD			8
#define BWT_CODE_PER_WORD			2
#define BIT_PER_CHAR				2
#define BITS_IN_WORD 				32
#define truncateRight(value, offset)                    ( (value) >> (offset) << (offset) )
#define truncateLeft(value, offset)                     ( (value) << (offset) >> (offset) )
#define LOW_BIT                                 0x5555555555555555
#define HIGH_BIT                                0xCCCCCCCCCCCCCCCC
#define LONG_ALL_ONE                            0xFFFFFFFFFFFFFFFF
#define GPU_OCC_INTERVAL 			(128)
#define GPU_OCC_INTERVAL_DIV_2		(64)
#define LOG2_GPU_OCC_INTERVAL		(7)
#define RESULT_BUFFER_THRESHOLD		(1)
const int TAIL_LENGTH = QUERY_LENGTH % CHAR_PER_WORD;
const int QUERY_SIZE_IN_WORD = (QUERY_LENGTH + CHAR_PER_WORD - 1) / CHAR_PER_WORD;
//struct timeval start_match, end_match;
static int exactMatch = 0, _1mismatch = 0, _2mismatch =0, totalMatch = 0;
//static unsigned int * occCountMap;
#define BLOCK_SIZE	1024
const int THREAD_SIZE = 256;
//#define QUERY_PER_BLOCK  ((QUERY_NUM + (BLOCK_SIZE - 1))/ BLOCK_SIZE)
const int SA_INTERVAL_PER_QUERY = 1;
const int SMALL_DATA_SIZE = 10000;
const int SMALL_BLOCK_SIZE = 128;
const int SMALL_THREAD_SIZE = 32;

#define MAX_NUM_ALIGN_PER_QUERY (100)
//#define OCC_COUNT_PER_THREAD (0)
#define MAX_THREAD_NUM (256)
//////////////////////////////////////////////////////////////////////////
//configuration for the evaluation
//#define PREFER_L1		
#define CONCURRENT_EXEC		

#define LAYER_INDEX_1 (1)
#define LAYER_INDEX_2 (0)
#define BYTE_4 (0)
#define BYTE_16 (1)
#define SORT_QUERY (0)
#define TEXTURE (0)

#define OCC_COUNT_PER_THREAD (12) //the number of elements stored in the shared mem., 0, 4, 8, 12

#define OPT_NUM_RESULT (5) 


#define CPU_SA_BUFSIZE                          (8*((uint64)(1024*1024*1024)))          //for CPU output
#define GPU_BUFSIZE                             (2.8*((uint64)(1024*1024*1024)))        //for GPU result output

//result report mode
#define REPORT_BEST	(0)
#define ALL_VALID 	(1)



#endif /*__SETTINGS_H__*/
